package com.suntop.carousel.qlmediaplay.banner;

import android.content.Context;
import android.util.AttributeSet;

import com.suntop.carousel.qlmediaplay.bean.Option;
import com.suntop.carousel.qlmediaplay.media.IMediaPlayer;
import com.suntop.carousel.qlmediaplay.tools.MediaHelper;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

public class NewSingleBanner extends SingleBasicBanner<Option>{
    public NewSingleBanner(@NonNull Context context) {
        super(context);
    }

    public NewSingleBanner(@NonNull Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }

    public NewSingleBanner(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    protected void buildMediaUrl(IMediaPlayer mediaPlayer, Option option, int position, boolean isVideo) {
             mediaPlayer
                     .setScaleType(option.getScaleType())
                     .setDelayTime(option.getDelayTime())
                     .setLoop(option.isLoop())
                     .setDate(option.getPath());
    }

    @Override
    protected boolean isVideoUrlPlay(Option option) {
        boolean videoFileType = MediaHelper.isVideoFileType(option.getPath());
        return videoFileType;
    }
}
